package concurrent.reentrantLock;

import java.util.concurrent.locks.LockSupport;

public class LockSupportDemo {
    public static void main(String[] args) {

        Thread thread1 = new Thread() {
            @Override
            public void run() {
                System.out.println("线程：" + Thread.currentThread().getName() + "开始执行");
                LockSupport.park()  ;

                System.out.println("线程：" + Thread.currentThread().getName() + "执行结束");
            }
        };
        thread1.start();


        new Thread(() -> {
            System.out.println("线程：" + Thread.currentThread().getName() + "开始结束挂起");
            LockSupport.unpark(thread1);
            System.out.println("线程：" + Thread.currentThread().getName() + "unpark结束");
        }).start();
    }
}
